﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
namespace ExpenseManagement.Utility
{
    public class Utils
    {
        public static string ReadView(string fileName)
        {
            string path = System.AppDomain.CurrentDomain.BaseDirectory;
            string fileContent;
            using (System.IO.StreamReader Reader = new System.IO.StreamReader(path + "htm\\" + fileName))
            {
                fileContent = Reader.ReadToEnd();
            }
            return fileContent;
        }

        //public static void BindView<T>(ref StringBuilder view, T model)
        //{
        //    System.Reflection.PropertyInfo[] properties = model.GetType().GetProperties();
        //    foreach (var property in properties)
        //    {
        //        view.Replace("$" + property.Name.ToString() + "$", model.GetType().GetProperty(property.Name).GetValue(model, null).ToString());
        //    }
        //}

        //public static void UnbindView<T>(System.Collections.Specialized.NameValueCollection view, T model)
        //{
        //    System.Reflection.PropertyInfo[] properties = model.GetType().GetProperties();
        //    foreach (var property in properties)
        //    {
        //        model.GetType().GetProperty(property.Name).SetValue(model, view[property.Name], null);
        //    }
        //}
    }
}